<template>
	<view class="more">
		<image :style="'padding-top:' + titleHeight + 'px'" class="search"
			src="https://siha.vxmeng.com/static/privacy/search.png" mode="widthFix"></image>
		<view class="videoImg">
			<swiper class="swiper" circular :autoplay="autoplay" :interval="interval"
				:duration="duration">
				<swiper-item class="swiper-item" v-for="(item,index) in episodeBanner">
					<image :src="getImg(item.image)" mode="aspectFill"></image>
					<!-- 					<view class="play" @click="profile(item.id,item.episode_info_id)">
						<text>{{$t('gdjj.ksgk')}}</text>
					</view> -->
					<view class="info">
						<view class="name">
							<text>{{item.name}}</text>
							<image src="https://siha.vxmeng.com/static/index/wh.png" mode=""></image>
						</view>
						<view class="time">
							<text>2024年</text>
							<text>2h 30min</text>
						</view>
						<view class="other">
							<text>爱对了人，才是初恋</text> / <text>中国大陆</text> / <text>24集全</text>
						</view>
						<image @click="comLink('/pages/more/cpDetail?id='+item.id)"
							class="yhj" src="https://siha.vxmeng.com/static/more/Vector.png" mode="aspectFit"></image>
						<view class="zzc"></view>
					</view>
				</swiper-item>
			</swiper>
		</view>
		<view class="content">
			<view class="tabs">
				<view class="item" @click="getEpisodeHot(1)" :class="active==1?'on':''">
					<text>筹拍中</text>
					<image src="https://siha.vxmeng.com/static/more/ps.png" mode="widthFix"></image>
				</view>
				<view class="item" @click="getEpisodeHot(2)" :class="active==2?'on':''">
					<text>已上线</text>
				</view>
				<view class="item" @click="active=3" :class="active==3?'on':''">
					<text>历史记录</text>
				</view>
			</view>

			<view class="list" v-if="active==1">
				<view class="item" v-for="(item,index) in hotList" @click="comLink('/pages/more/cpDetail?id='+item.id)">
					<view class="top">
						<image :src="getImg(item.image)" mode="aspectFill"></image>
					</view>
					<view class="cen">
						{{item.name}}
					</view>
					<view class="bot">
						<text style="font-size: 22rpx;color: #fff;">投票进度:</text>
						<view class="sliderBox">
							<image :style="{left: ((item.yes_money/item.money*100)).toFixed(1)+'%'}" src="https://siha.vxmeng.com/static/more/slider.png" mode="heightFix"></image>
						</view>
						<text style="color: #6D91F0;font-size: 24rpx;">{{((item.yes_money/item.money*100)).toFixed(1)}}%</text>
					</view>
				</view>
			</view>

			<view class="list2" v-if="active==2">
				<view class="item" v-for="(item,index) in hotList" @click="comLink('/pages/more/detail?id='+item.id)">
					<view class="t">
						<text class="l">{{item.name}}</text>
						<view class="r">
							<view class="imgs">
								<image v-for="(item,index) in item.score/2" src="https://siha.vxmeng.com/static/more/on.png"
									mode="widthFix"></image>
								<image v-for="(item,index) in 5-item.score/2" src="https://siha.vxmeng.com/static/more/no.png"
									mode="widthFix"></image>
							</view>
							<text>{{Number(item.score).toFixed(1)}}</text>
						</view>
					</view>
					<view class="b">
						<image :src="getImg(item.image)" mode="aspectFill"></image>
						<view class="rig">
							<view class="text">
								{{item.blurb}}
							</view>
						</view>
					</view>
				</view>
			</view>

			<view class="list2" v-if="active==3">
				<view class="item" v-for="(item,index) in hotList" @click="comLink('/pages/more/detail?id='+item.id)">
					<view class="t">
						<text class="l">{{item.name}}</text>
					</view>
					<view class="b">
						<image :src="getImg(item.image)" mode="aspectFill"></image>
						<view class="rig">
							<view class="text">
								{{item.blurb}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<tabBar></tabBar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				titleHeight:0,
				episodeBanner: [],
				hotList: [],
				active: 1,
				indicatorDots: true,
				autoplay: true,
				interval: 3000,
				duration: 500
			}
		},
		onShow() {
			// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-ALIPAY
			this.getHeight();
			// #endif
			this.getEpisodeBanner()
			this.getEpisodeHot(1)
		},
		methods: {
			// 获取微信右上角胶囊高度
			getHeight() {
				let res = wx.getMenuButtonBoundingClientRect();
				this.titleHeight = res.top;
			},
			async getEpisodeBanner() {
				const res = await this.$myRequest({
					url: 'api/episode/getEpisodeBanner',
					data: {
						source: 1,
					}
				})
				if (res.code == 1) {
					console.log(res)
					this.episodeBanner = res.data
				}
			},

			async getEpisodeHot(e) {
				this.active = e
				const res = await this.$myRequest({
					url: 'api/episode/getEpisodeHot',
					data: {
						source: 1,
						status: e
					}
				})
				if (res.code == 1) {
					console.log(res)
					this.hotList = res.data.list
				}
			},

			async profile(e, f) {
				const res = await this.$myRequest({
					url: 'api/user/profile',
					data: {
						episode_info_id: e
					}
				})
				if (res.code == 1) {
					console.log(res)
					this.comLink('/pages/index/siha?id=' + f)
				}
			},

		}
	}
</script>

<style lang="less" scoped>
	.more {
		width: 100%;
		min-height: 100vh;
		display: flex;
		flex-direction: column;
		align-items: center;
		background-color: rgb(10, 12, 11);
		position: relative;
		.search {
			position: fixed;
			top: calc(50rpx + var(--status-bar-height));
			right: 50rpx;
			width: 48rpx;
			z-index: 101;
		}
		.videoImg {
			width: 100%;
			height: 780rpx;

			.swiper {
				width: 100%;
				height: 100%;

				/deep/.uni-swiper-dots-horizontal {
					left: auto;
					right: 10%;
					bottom: 100rpx;
				}
			}

			.swiper-item {
				width: 750rpx;
				height: 500rpx;
				position: relative;

				image {
					width: 100%;
					height: 560rpx;
				}

				.play {
					position: absolute;
					left: 175rpx;
					bottom: 200rpx;
					width: 400rpx;
					height: 80rpx;
					background: linear-gradient(90deg, rgba(98, 182, 252, 0.95) 5%, rgba(95, 88, 253, 0.95) 100%);
					border-radius: 60rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					color: #fff;
					font-size: 32rpx;
				}

				.info{
					color: #fff;
					font-size: 24rpx;
					padding: 40rpx 30rpx;
					line-height: 1.6;
					position: relative;
					.zzc{
						height: 140rpx;
						width: 100%;
						background-image: linear-gradient(-180deg, rgba(55, 55, 55, 0) 0%, #0a0b0c 100%);
						position: absolute;
						top: -140rpx;
						left: 0;
					}
					
					.yhj{
						width: 70rpx;
						height: 70rpx;
						padding: 30rpx;
						background-color: #6259F0;
						border-radius: 50%;
						position: absolute;
						top: 48rpx;
						right: 48rpx;
					}
					.time{
						text{
							margin-right: 20rpx;
						}
					}
					.name{
						font-size: 36rpx;
						margin-bottom: 10rpx;
						display: flex;
						align-items: center;
						image{
							width: 40rpx;
							height: 40rpx;
							margin-left: 10rpx;
						}
					}
					
				}
			}
		}

		.content {
			width: 690rpx;
			padding-bottom: 160rpx;

			.tabs {
				display: flex;
				padding: 10rpx 0 20rpx;

				.item {
					display: flex;
					align-items: center;
					color: #fff;
					opacity: 0.6;
					font-size: 32rpx;
					margin-right: 40rpx;

					&.on {
						opacity: 1;
					}

					image {
						width: 32rpx;
						margin-left: 10rpx;
					}
				}
			}

			.list {
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;
				color: #fff;
				.item {
					width: 336rpx;
					height: 280rpx;
					margin-bottom: 30rpx;
					display: flex;
					flex-direction: column;
					.top{
						flex: 1;
						width: 100%;
						image{
							width: 100%;
							height: 100%;
							border-radius: 20rpx;
						}
					}
					.cen{
						width: 100%;
						font-size: 28rpx;
						line-height: 50rpx;
						white-space: nowrap;
						text-overflow: ellipsis;
						overflow: hidden;
					}
					.bot{
						width: 336rpx;
						display: flex;
						justify-content: space-between;
						align-items: center;
						.sliderBox{
							width: 150rpx;
							height: 10rpx;
							border: 2rpx solid #851FEB;
							border-radius: 5rpx;
							overflow: hidden;
							position: relative;
							image{
								height: 100%;
								border-radius: 5rpx;
								position: absolute;
								transform: translateX(-100%);
							}
						}
					}
				}
			}
			
			.list2 {
				.item {
					width: 100%;
					padding: 20rpx 0;

					.t {
						display: flex;
						align-items: center;
						justify-content: space-between;
						margin-bottom: 16rpx;

						.l {
							color: #fff;
							font-size: 32rpx;
							// width: 40%;
							display: -webkit-box;
							-webkit-box-orient: vertical;
							// overflow: hidden;
							-webkit-line-clamp: 1;
							// text-overflow: ellipsis;
							font-size: 32rpx;
						}
						
						.r {
							color: #FFD673;
							font-size: 32rpx;
							display: flex;
							align-items: baseline;
							margin-top: 10rpx;
						
							.imgs {
								margin-right: 20rpx;
						
								image {
									width: 30rpx;
									margin-left: 10rpx;
								}
							}
						}
					}

					.b {
						display: flex;
						justify-content: space-between;

						image {
							width: 262rpx;
							height: 190rpx;
							border-radius: 10rpx;
						}
						.image{
							
						}

						.rig{
							width: calc(100% - 300rpx);
							padding-top: 10rpx;
							.text {
								width: 100%;
								line-height: 1.8;
								display: -webkit-box;
								-webkit-box-orient: vertical;
								overflow: hidden;
								text-align: justify;
								-webkit-line-clamp: 4;
								/* 显示3行文本 */
								text-overflow: ellipsis;
							}
							.r {
								color: #FFD673;
								font-size: 32rpx;
								display: flex;
								align-items: baseline;
								justify-content: space-between;
								margin-top: 10rpx;
							
								.imgs {
									margin-right: 20rpx;
							
									image {
										width: 30rpx;
										margin-left: 10rpx;
									}
								}
							}
						}

						font-size: 24rpx;
						color: #D8D8D8;
						opacity: 0.8;
					}
				}
			}
		}
	}
</style>